package com.iengoo.day13.ctrl;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author zpym
 * @CopyRight (C) http://www.iengoo.com
 * @brief 在servlet 中返回页面
 * @email 122162005@qq.com
 * @date 2019-01-25 16:15
 */
public class TicketCtrl implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        // 将数据放到 请求对象里面
        servletRequest.setAttribute("ticketNo", 1000);
        // 请求转发
        servletRequest.getRequestDispatcher("/WEB-INF/jsp/ticket.jsp").forward(servletRequest, servletResponse);
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
